<template>
    <div class="parent">
        <div class="topTitle">
            <span>掌上缴费</span>
        </div>
        <div class="inpu">
            <div class="inpTitle">
                <span>注册账号<i><label></label></i></span>
            </div>
        </div>
        <div class="cont">
            <div class="inp">
                <label class="iconfont icon-zhanghu"></label>
                <input type="text" placeholder="手机号码" v-model.trim="iphone">
            </div>
            <div class="inp">
                <label class="iconfont icon-mima"></label>
                <input type="text" placeholder="输入密码" v-model.trim="pwd">
            </div>
            <div class="inp">
                <label class="iconfont icon-mima"></label>
                <input type="text" placeholder="再次输入密码" v-model.trim="againPwd">
            </div>
        </div>
        <div class="btn">
            <div class="btnText" @click="login">
                <span>确定</span>
            </div>
        </div>
    </div>
</template>
<script>
import Qs from 'qs'
// import { setTimeout } from 'timers';
export default {
    name: 'Register',
    data () {
        return {
            iphone: '',
            pwd: '',
            againPwd: ''
        }
    },
    methods: {
        login () {
            const reg = /^1[34578]\d{9}$/;
            const pwdReg = /^[\w]{6,16}$/;
            let iphone = reg.test(this.iphone)
            let pwd = pwdReg.test(this.pwd)
            if (iphone && pwd && (this.againPwd === this.pwd)) {
                this.$axios.post('http://192.168.1.26:8080/app/mock/16/api/register', Qs.stringify({
                    iphone: this.iphone,
                    pwd: this.pwd,
                    againPwd: this.againPwd
                })).then((res) => {
                    sessionStorage.setItem("loginIphone", this.iphone);
                    sessionStorage.setItem("loginPwd", this.pwd);
                    setTimeout(() => {
                        this.$router.push({
                            path: '/Login'
                        })
                    }, 600)
                })
            }
        }
    }
}
</script>
<style scoped lang="less">
.parent{
    width: 100%;
    height: 100%;
    background:linear-gradient(360deg,rgba(255,199,38,1) 0%,rgba(249,151,22,1) 100%);
    padding: 0 1.333333rem;
    padding-top: 3.84rem;
}
.topTitle{
    width: 100%;
    height: 1.333333rem;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    span{
        font-size:48px;
        font-family:hzgb;
        color:rgba(255,255,255,1);
        line-height:48px;
        letter-spacing:4px;
        text-shadow:0px 2px 4px rgba(76,33,0,0.24);
    }
}
.inpu{
    width: 100%;
    height: 1.333333rem;
    margin-top: 1.706667rem;
    .inpTitle{
        width: 100%;
        height: 1.333333rem;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        background: #fff;
        span{
            display: block;
            width: 100%;
            height: 100%;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            font-size:14px;
            font-family:Arial-BoldMT;
            font-weight:normal;
            color:rgba(255,199,38,1);
            line-height:16px;
            letter-spacing:1px;
            position: relative;
            i{
                position: absolute;
                bottom: 0;
                left: 0;
                display: block;
                width: 100%;
                height: 100%;
                border-bottom:3px solid rgba(255,199,38,1);
                label{
                    position: absolute;
                    bottom: 0;
                    left: 50%;
                    display: block;
                    width: 0;
                    height: 0;
                    border: 6px solid transparent;
                    border-bottom: 6px solid rgba(255,199,38,1);
                }
            }
        }
    }
}
.cont{
    width: 100%;
    height: 4rem;
    .inp{
        width: 100%;
        height: 1.333333rem;
        background: #fff;
        display: flex;
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        border-top: 0.1px solid #ccc;
        padding: 0 .266667rem;
        label{
           display: block;
            width: .426667rem;
            height: .426667rem;
            display: flex;
            flex-direction: row;
            justify-content: center;
            align-items: center;
            font-size: 16px;
            color: #ccc;
        }
        input{
            width: 5.9rem;
            height: .933333rem;
            margin-left: .2rem;
            border: none;
            outline: none;
            font-size:12px;
        }
        input::-webkit-input-placeholder{
            font-size:12px;
            font-family:ArialMT;
            color:rgba(204,204,204,1);
            line-height:14px;
            letter-spacing:1px;
        }
    }
}
.btn{
    width: 100%;
    height: 1.28rem;
    background: #fff;
    margin-top: .613333rem;
    .btnText{
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        span{
            font-size:18px;
            font-family:Arial-BoldMT;
            font-weight:normal;
            color:rgba(255,199,38,1);
            line-height:21px;
            letter-spacing:1px;
        }
    }
}
</style>
